/**
 * 
 */
package com.angel.dao.generic.factory;


/** Creates DAO object. At an asbtract sub class DAOFactory, you must add abstract method to get DAO objects.
 * At this way, you can generate an BusinessObjectDAO with getBusinessObjectDAO() method.
 * And all classes which extends this factory class (For example: HibernateDAOFactory class) must know how generate all business objects DAO.   
 * 
 * Creates a standalone DAOFactory that returns unmanaged DAO beans for use in any environment where Hibernate
 * has been configured for. 
 * 
 * @author William
 */
public abstract class DAOFactory {
	
    /**
     * Factory method for instantiation of concrete factories.
     */
    public static DAOFactory instance(Class<? extends DAOFactory> factory) {
        try {
            return factory.newInstance();
        } catch (Exception ex) {
            throw new RuntimeException("Couldn't create DAOFactory: " + factory);
        }
    }
}
